import 'package:flutter/material.dart';
import 'package:genxue/Pages/DiscoverHomeView.dart';
import 'package:genxue/Pages/HomePageView.dart';
import 'package:genxue/Pages/LongdistanceHomeView.dart';
import 'package:genxue/Pages/MineHomeView.dart';
import 'package:cupertino_icons/cupertino_icons.dart';
class RemoteNavigatorState extends StatefulWidget {
  const RemoteNavigatorState({Key? key}) : super(key: key);

  @override
  _RemoteNavigatorStateState createState() => _RemoteNavigatorStateState();
}

class _RemoteNavigatorStateState extends State<RemoteNavigatorState> {
  final  PageController _pageViewController = PageController(
    initialPage: 0
  );
  int _currentIndex = 0;
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: PageView(
        controller: _pageViewController,
        children: [
          HomePageView(),
          LongdistanceHomeView(),
          DiscoverHomeView(),
          MineHomeView()
        ],
      ),
      bottomNavigationBar: BottomNavigationBar(
        currentIndex: _currentIndex,
        type: BottomNavigationBarType.fixed,
        onTap: (index) {
          _pageViewController.jumpToPage(index);
          setState(() {
            _currentIndex = index;
          });
        },
        selectedItemColor: Colors.red,
        unselectedItemColor: Colors.black, ,
        items: [
          BottomNavigationBarItem(
              icon: Text("11", style: TextStyle(color: Colors.black)),
              activeIcon:Text("11", style: TextStyle(color: Colors.red)),
              label: "首页",
          ),
          BottomNavigationBarItem(
              icon: Text("22", style: TextStyle(color: Colors.black)),
              activeIcon: Text("22", style: TextStyle(color: Colors.red)),
              label: "Longdistance"
          ),
          BottomNavigationBarItem(
              icon: Text("33", style: TextStyle(color: Colors.black)),
              activeIcon: Text("33", style: TextStyle(color: Colors.red)),
              label: "发现"
          ),
          BottomNavigationBarItem(
              icon: Text("44", style: TextStyle(color: Colors.black)),
              activeIcon: Text("44", style: TextStyle(color: Colors.red)),
              label: "我的"
          )
        ],

      ),
    );
  }

}
